package com.commerce.common.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("orders")
public class Order {

  @TableId(type = IdType.AUTO)
  private Long id;

  @TableField("order_no")
  private String orderNo;

  @TableField("user_id")
  private Long userId;

  @TableField("total_amount")
  private Double totalAmount;

  @TableField("pay_amount")
  private Double payAmount;

  @TableField("freight_amount")
  private Double freightAmount;

  @TableField("discount_amount")
  private Double discountAmount;

  private Integer status;

  @TableField("payment_method")
  private String paymentMethod;

  @TableField("payment_time")
  private LocalDateTime paymentTime;

  @TableField("delivery_company")
  private String deliveryCompany;

  @TableField("delivery_no")
  private String deliveryNo;

  @TableField("delivery_time")
  private LocalDateTime deliveryTime;

  @TableField("receive_time")
  private LocalDateTime receiveTime;

  @TableField("address_id")
  private Long addressId;

  @TableField("receiver_name")
  private String receiverName;

  @TableField("receiver_phone")
  private String receiverPhone;

  @TableField("receiver_address")
  private String receiverAddress;

  private String note;

  @TableField("delivery_method")
  private String deliveryMethod;

  @TableField("invoice_type")
  private String invoiceType;

  @TableField("invoice_title")
  private String invoiceTitle;

  @TableField("invoice_tax_no")
  private String invoiceTaxNo;

  @TableField("create_time")
  private LocalDateTime createTime;

  @TableField("update_time")
  private LocalDateTime updateTime;
  
  // 非数据库字段，用于存储订单项
  private transient List<OrderItem> orderItems;
} 
